//
//  HLHomeCollectionView.m
//  HanlinWeather
//
//  Created by 任翰林 on 17/1/13.
//  Copyright © 2017年 任翰林. All rights reserved.
//

#import "HLHomeCollectionView.h"
#import <Masonry.h>
#import "HLHomeCollectionViewCell.h"
@interface HLHomeCollectionView ()<UICollectionViewDelegate,UICollectionViewDataSource>

@end
@implementation HLHomeCollectionView

- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{
    if ([super initWithFrame:frame collectionViewLayout:layout]) {
        
        self.delegate = self;
        self.dataSource = self;
        self.backgroundColor = KWhiteColor;
        self.pagingEnabled = YES;
        [self registerClass:[HLHomeCollectionViewCell class] forCellWithReuseIdentifier:@"cell"];
    }
    return self;
}

//返回行
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section;
{
    return 2;
}

////返回组
//- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView;
//{
//    return 2;
//}
// The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath:
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath;
{

    HLHomeCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"cell" forIndexPath:indexPath];
//    cell.gaodeMapPushBlock = ^(NSInteger section,NSInteger row){
//        HLLog(@"你点击的是%ld组，%ld行",section,row);
//        self.gaodeMapPushBlock();
//    };
    
    
    if (!cell) {
        cell = [[HLHomeCollectionViewCell alloc]init];
    }

    cell.homePushBlock = ^(NSInteger section, NSInteger row){
        self.homeTablePushBlock(section,row);
    };
    
    return cell;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
